#include "..\..\TYPES.H"
#include "..\COMMON\HMX_TYPES.H"
#include "SVDBMP.H"

char* SprCmpFileName = "TITLE\\BMP\\SAVEDATS.CM_";
char* TileCmpFileName = "TITLE\\BMP\\SAVEDATT.CM_";
int nPosiXSprMes[27] = {
   96, 104, 112, 120, 128, 136, 144, 152, 160,
  168, 176, 184, 192, 200, 208, 216, 224, 232,
  240, 248, 256, 264, 272, 280, 288, 296, 304
};
static unsigned int hSprSonicRun[3];
static unsigned int hSprSonicStop[3];
static unsigned int hSprCursol;
static unsigned int hSprFileMark[7];
static unsigned int hSprBG[4];
static unsigned int hSprFileBG;
static unsigned int hSprDummy;
static unsigned int hSprCmd[5];
sprite_bmp infoSprtBmp[209] = {
  {  48,  16,  16,  48,  30, 32, 0, 0, &hSprCmd[0] },
  {  48,  16,  16,  48,  30, 32, 0, 0, &hSprCmd[0] },
  {  48,  16,  16,  72,  30, 32, 0, 0, &hSprCmd[1] },
  {  48,  16,  16,  72,  30, 32, 0, 0, &hSprCmd[1] },
  {  48,  16,  16,  96,  30, 32, 0, 0, &hSprCmd[2] },
  {  48,  16,  16,  96,  30, 32, 0, 0, &hSprCmd[2] },
  {  48,  16,  16, 120,  30, 32, 0, 0, &hSprCmd[3] },
  {  48,  16,  16, 120,  30, 32, 0, 0, &hSprCmd[3] },
  {  48,  16,  16, 144,  30, 32, 0, 0, &hSprCmd[4] },
  {  48,  16,  16, 144,  30, 32, 0, 0, &hSprCmd[4] },
  {  24,  24,  96,  32,  30, 64, 0, 0, &hSprFileMark[0] },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {  16,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {  16,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {  16,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {  16,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {  16,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {  16,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {  16,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {  16,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {  16,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {  16,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {  16,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {  16,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {  16,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {  16,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {  16,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {  16,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {  16,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {  16,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {  16,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {  16,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {  16,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {  16,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {  16,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {  16,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {  16,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {  16,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {  16,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {  16,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {  16,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {  16,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {  16,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {  16,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {  16,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {  16,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {  16,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {  16,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {  16,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {  16,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {  16,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {  16,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {  16,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {  16,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {  16,  16,   0,   0,  30, 48, 0, 0, &hSprDummy },
  {   8,   8,   0,   0,  41, 16, 0, 0, &hSprCursol },
  { 184,  24, 128,  32, 140, 32, 0, 0, &hSprFileBG },
  {  24,  24,  96,  32,  40, 64, 0, 0, &hSprFileMark[1] },
  {  24,  24,  96,  64,  40, 64, 0, 0, &hSprFileMark[2] },
  {  24,  24,  96,  96,  40, 64, 0, 0, &hSprFileMark[3] },
  {  24,  24,  96, 128,  40, 64, 0, 0, &hSprFileMark[4] },
  {  24,  24,  96, 160,  40, 64, 0, 0, &hSprFileMark[5] },
  {  24,  24,  96, 192,  40, 64, 0, 0, &hSprFileMark[6] },
  { 160, 112,   0, 112, 150, 16, 0, 0, &hSprBG[0] },
  { 160, 112, 160, 112, 150, 16, 0, 0, &hSprBG[1] },
  { 160, 112,   0,   0, 150, 16, 0, 0, &hSprBG[2] },
  { 160, 112, 160,   0, 150, 16, 0, 0, &hSprBG[3] },
  {  16,  24,   0,   0,  20, 64, 0, 0, &hSprSonicStop[0] },
  {  16,  24,   0,   0,  20, 64, 0, 0, &hSprSonicStop[1] },
  {  16,  24,   0,   0,  20, 64, 0, 0, &hSprSonicStop[2] },
  {  16,  24,   0,   0,  20, 64, 0, 0, &hSprSonicRun[0] },
  {  16,  24,   0,   0,  20, 64, 0, 0, &hSprSonicRun[1] },
  {  16,  24,   0,   0,  20, 64, 0, 0, &hSprSonicRun[2] }
};
mark_info markTable[10] = {
  { 63, 155, 156, 157, 158 },
  { 47, 159, 160, 161, 162 },
  { 46, 163, 164, 165, 166 },
  { 45, 167, 168, 169, 170 },
  { 44, 171, 172, 173, 174 },
  { 41, 175, 176, 177, 178 },
  { 40, 179, 180, 181, 182 },
  { 39, 183, 184, 185, 186 },
  { 34, 187, 188, 189, 190 }
};
static unsigned int hGridBack;
static unsigned int hTileBack[1];
static unsigned int* hBmpBack[1];
grid_bmp infoGridBmp[1] = {
  { 1, 8, 8, { 0, 0 }, 120, 32, hBmpBack, hTileBack, &hGridBack }
};
POINT nPosiXSprFile[56] = {
  { 128, 0 },
  { 136, 0 },
  { 144, 0 },
  { 152, 0 },
  { 160, 0 },
  { 168, 0 },
  { 176, 0 },
  { 184, 0 },
  { 192, 0 },
  { 200, 0 },
  { 208, 0 },
  { 216, 0 },
  { 144, 10 },
  { 152, 10 },
  { 160, 10 },
  { 168, 10 },
  { 176, 10 },
  { 184, 10 },
  { 192, 10 },
  { 212, 4 },
  { 220, 4 },
  { 228, 4 },
  { 236, 4 },
  { 244, 4 },
  { 252, 4 },
  { 260, 4 },
  { 268, 4 },
  { 276, 4 },
  { 284, 4 },
  { 292, 4 },
  { 228, 14 },
  { 236, 14 },
  { 244, 14 },
  { 252, 14 },
  { 260, 14 },
  { 268, 14 },
  { 276, 14 },
  { 284, 14 },
  { 292, 14 },
  { 300, 14 },
  { 308, 14 },
  { 316, 14 },
  { 324, 14 },
  { 332, 14 },
  { 160, 8 },
  { 168, 8 },
  { 176, 8 },
  { 184, 8 },
  { 192, 8 },
  { 200, 8 },
  { 208, 8 },
  { 216, 8 },
  { 224, 8 },
  { 232, 8 },
  { 240, 8 },
  { 248, 8 }
};
int PRIO_MAX = 160;
unsigned short NUM_BMP = 209;
int PLAYERCHAR_W = 8;
unsigned short NUM_GRIDBMP = 1;
unsigned short IDX_GDBMP_BACK = 0;
unsigned int hSprMes[27];
unsigned int hSprFile[56][6];
